home *** CD-ROM | disk | FTP | other *** search
- .xlist
- include cmacro32.inc
- include windows.inc
- .list
-
- ?PLM=1
- ?WIN=0
-
- ifndef SEGNAME
- SEGNAME equ <_TEXT32>
- endif
-
- createSeg %SEGNAME, CodeSeg, word, public, CODE
-
- sBegin CodeSeg
- .386
- assumes cs,CodeSeg
- assumes ds,nothing
- assumes es,nothing
-
- ;-----------------------------------------------------------------------;
- ; dib_xy bpp, x, y
- ;
- ; Entry:
- ; esi --> BITMAPINFO
- ; edi --> BITS
- ; Exit:
- ; esi --> BITMAPINFO
- ; edi --> BITS (x,y)
- ; ecx -- next_scan
- ;
- ; NOTE:
- ; biSizeImage *must* be right
- ;-----------------------------------------------------------------------;
-
- dib_xy macro dib_x, dib_y, dib_bpp
- LOCAL l1
-
- mov ebx,dib_x
- mov ecx,[esi].biWidth ; get width pixels
-
- ifb <dib_bpp>
- movzx eax,[esi].biBitCount
- shr eax,3
- xchg ebx,eax
- mul ebx
- xchg ebx,eax
- mul ecx
- mov ecx,eax
- elseif (dib_bpp eq 8)
- ; nothing
- elseif (dib_bpp eq 16)
- add ebx,ebx
- add ecx,ecx ; convert to width bytes
- elseif (dib_bpp eq 24)
- lea ebx,[ebx + 2*ebx]
- lea ecx,[ecx + 2*ecx] ; convert to width bytes
- elseif (dib_bpp eq 32)
- lea ebx,[4*ebx]
- lea ecx,[4*ecx] ; convert to width bytes
- else
- ack
- endif
- add ecx,3 ; round up to dword
- and cl,not 3
-
- add edi,ebx ; add in x offset
- mov edx,[esi].biHeight ; get height
- or edx,edx ; if < 0 then it is a
- jge short l1 ; top to bottom dib
-
- neg ecx ; WidthBytes = -WidthBytes
- add edi,[esi].biSizeImage ; point edi to "first" scan
- add edi,ecx
- l1:
- ; ecx = next_scan, eax = y
- mov eax,dib_y
- imul ecx ; eax = y * next_scan
- add edi,eax ; edi -> (x,y)
- endm
-
- ;--------------------------Private-Routine-------------------------------;
- ; DVABlt
- ;
- ; draws a solid rect
- ;
- ; Entry:
- ; lpBits bits pointer
- ; width_bytes width in bytes to next scan
- ; lpPoints points to draw.
- ; Return:
- ; none
- ; Error Returns:
- ; none
- ; Registers Preserved:
- ; none
- ; Registers Destroyed:
- ; AX,BX,CX,DX,DS,ES,SI,DI,FLAGS
- ; Calls:
- ; non
- ; History:
- ; Mon 26-Mar-1990 -by- Todd Laney [ToddLa]
- ;-----------------------------------------------------------------------;
- assumes ds,nothing
- assumes es,nothing
-
- DVABltLoopStart label word
- dd DVABltStart0
- dd DVABltStart1
- dd DVABltStart2
- dd DVABltStart3
-
- cProc DVABlt,<FAR,PUBLIC,PASCAL>,<ds>
- parmD biDst
- parmD lpDst
- parmD DstX
- parmD DstY
- parmD DstDX
- parmD DstDY
- parmD biSrc
- parmD lpSrc
- parmD SrcX
- parmD SrcY
-
- localD src_next_scan
- localD dst_next_scan
- cBegin
- push edi
- push esi
-
- xor esi,esi
-
- and DstDX, not 3
- jz DVABltExit
-
- lds si,biSrc ; ds:esi --> bitmapinfo
- movzx edi,word ptr lpSrc[0] ; edi --> bits
- dib_xy SrcX, SrcY
- mov src_next_scan, ecx
- push edi
-
- xor edi,edi
- lds si,biDst ; ds:esi --> bitmapinfo
- les di,lpDst ; edi --> bits
- dib_xy DstX, DstY
- mov dst_next_scan, ecx
-
- pop esi ; ds:esi --> source.
- mov ds,word ptr lpSrc[2]
-
- mov ecx, DstDX
- sub src_next_scan,ecx
- sub dst_next_scan,ecx
-
- mov ebx,DstX
- and ebx,011b
- jmp DVABltLoopStart[ebx*4]
-
- DVABltStart0:
- mov ecx,DstDX
- shr ecx,2
- mov DstDX,ecx
- DVABltLoop0:
- mov ecx,DstDX
- rep movs dword ptr es:[edi], dword ptr ds:[esi]
- add edi,dst_next_scan
- add esi,src_next_scan
- dec DstDY
- jnz short DVABltLoop0
- jz DVABltExit
-
- DVABltStart1:
- mov ecx,DstDX
- sub ecx,3
- shr ecx,2
- mov DstDX,ecx
- DVABltLoop1:
- mov ecx,DstDX
- movs byte ptr es:[edi], byte ptr ds:[esi]
- movs word ptr es:[edi], word ptr ds:[esi]
- rep movs dword ptr es:[edi], dword ptr ds:[esi]
- movs byte ptr es:[edi], byte ptr ds:[esi]
- add edi,dst_next_scan
- add esi,src_next_scan
- dec DstDY
- jnz short DVABltLoop1
-
- jz DVABltExit
-
- DVABltStart2:
- mov ecx,DstDX
- sub ecx,2
- shr ecx,2
- mov DstDX,ecx
- DVABltLoop2:
- mov ecx,DstDX
- movs word ptr es:[edi], word ptr ds:[esi]
- rep movs dword ptr es:[edi], dword ptr ds:[esi]
- movs word ptr es:[edi], word ptr ds:[esi]
- add edi,dst_next_scan
- add esi,src_next_scan
- dec DstDY
- jnz short DVABltLoop2
-
- jz DVABltExit
-
- DVABltStart3:
- mov ecx,DstDX
- sub ecx,1
- shr ecx,2
- mov DstDX,ecx
- DVABltLoop3:
- mov ecx,DstDX
- movs byte ptr es:[edi], byte ptr ds:[esi]
- rep movs dword ptr es:[edi], dword ptr ds:[esi]
- movs word ptr es:[edi], word ptr ds:[esi]
- movs byte ptr es:[edi], byte ptr ds:[esi]
- add edi,dst_next_scan
- add esi,src_next_scan
- dec DstDY
- jnz short DVABltLoop3
- jz DVABltExit
-
- DVABltExit:
- pop esi
- pop edi
- cEnd
-
-
- sEnd
- end
-